(rmail-get-coding-system): Re-search
authorKenichi Handa <handa@m17n.org>
Tue, 27 Jan 2009 04:48:09 +0000 (04:48 +0000)
committerKenichi Handa <handa@m17n.org>
Tue, 27 Jan 2009 04:48:09 +0000 (04:48 +0000)
rmail-mime-charset-pattern directly instead of using
mail-fetch-field.  Use coding-system-from-name.

lisp/mail/rmail.el

index 99bdcea051660f73aedc09fe34d3fd14b5688d5c..a96b52b86029387fdeb1fd44aaf930312b59a293 100644 (file)
@@ -940,13 +940,10 @@ This function also reinitializes local variables used by Rmail."
 (defun rmail-get-coding-system ()
   "Return a suitable coding system to use for the current mail message.
 The buffer is expected to be narrowed to just the header of the message."
-  (let ((content-type-header (mail-fetch-field "content-type"))
-       separator)
-    (save-excursion
-      (setq separator (search-forward "\n\n")))
-    (if (and content-type-header
-            (string-match rmail-mime-charset-pattern content-type-header))
-       (substring content-type-header (match-beginning 1) (match-end 1))
+  (save-excursion
+    (goto-char (point-min))
+    (if (re-search-forward rmail-mime-charset-pattern)
+       (coding-system-from-name (match-string 1))
       'undecided)))
 \f
 ;;; Set up Rmail mode keymaps